import {
  createRouter,
  createWebHashHistory
} from 'vue-router'

import Home from '@/views/home.vue'
import Detail from '@/views/detail.vue'
import SubDetail from '@/views/sub-detail.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('@/views/About.vue')
  },
  {
    path: '/detail/sub',
    name: 'SubDetail',
    component: SubDetail
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: Detail,
    children: [ // 嵌套的路由
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
